package sctu.edu.java.year2016.team06.chenqiang.day20160606.chapter11_2;

/**
 * Created by XQ on 2016/6/6.
 * 新建Number类，通过类中的count()方法可得到任意两个数相乘的结果，
 * 并在调用该方法的主方法中使用try..catch语句捕捉可能发生的异常
 */

import java.util.Scanner;

public class Number {

    public static void count(int x, int y) throws Exception {
        int s;
        s = x * y;
        System.out.println(s);
    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入任意两个数字：");
        int x = scan.nextInt();
        int y = scan.nextInt();
        Number number = new Number();
        try {
            number.count(x, y);
        } catch (Exception ex) {
            System.out.println(ex);
        }
    }
}
